<template>
    <div class="main-container">
        <el-row type="flex" :gutter="20">
            <el-col :span="6">
                <div class="grid-card">
                    <div class="grid-card_header">总用户数（个）</div>
                    <div class="grid-card_body">
                        <el-row type="flex">
                            <el-col :span="12">
                                <div class="grid-card_body_left">{{ cardData.userCount }}</div>
                            </el-col>
                            <el-col :span="12">
                                <div class="grid-card_body_right">
                                    <div class="grid-card_body_right_icon">
                                        <i class="el-icon-user-solid"></i>
                                    </div>
                                </div>
                            </el-col>
                        </el-row>
                    </div>
                    <div class="grid-card_footer">今日新增用户0个</div>
                </div>
            </el-col>
            <el-col :span="6">
                <div class="grid-card">
                    <div class="grid-card_header">总角色数（个）</div>
                    <div class="grid-card_body">
                        <el-row type="flex">
                            <el-col :span="12">
                                <div class="grid-card_body_left">{{ cardData.roleCount }}</div>
                            </el-col>
                            <el-col :span="12">
                                <div class="grid-card_body_right">
                                    <div class="grid-card_body_right_icon">
                                        <i class="el-icon-s-custom"></i>
                                    </div>
                                </div>
                            </el-col>
                        </el-row>
                    </div>
                    <div class="grid-card_footer">今日新增角色0个</div>
                </div>
            </el-col>
            <el-col :span="6">
                <div class="grid-card">
                    <div class="grid-card_header">总权限数（个）</div>
                    <div class="grid-card_body">
                        <el-row type="flex">
                            <el-col :span="12">
                                <div class="grid-card_body_left">{{ cardData.menuCount }}</div>
                            </el-col>
                            <el-col :span="12">
                                <div class="grid-card_body_right">
                                    <div class="grid-card_body_right_icon">
                                        <i class="el-icon-check"></i>
                                    </div>
                                </div>
                            </el-col>
                        </el-row>
                    </div>
                    <div class="grid-card_footer">今日新增权限0个</div>
                </div>
            </el-col>
        </el-row>
    </div>
</template>

<script>
import {getCardData} from '@/api/index/index';

export default {
    name: "DashBoard",
    data() {
        return {
            cardData: {}
        };
    },
    mounted() {
        this.queryCardData();
    },
    methods: {
        queryCardData() {
            getCardData().then(resp => {
                this.cardData = resp.data;
            }).catch((error) => {
                this.$message.warning(error.message);
            });
        }
    }
}
</script>

<style lang="scss" scoped>
.main-container {
    padding: 10px 20px;
}

.grid-card {
    background: white;
    border: 1px solid #DCDCDC;
    border-radius: 4px;
    height: 160px;
    padding: 8px;
    cursor: pointer;

    .grid-card_header {
        padding: 16px 24px;
        color: #1F1F1F;
        font-size: 14px;
        font-weight: 600;
    }

    .grid-card_body {
        padding: 16px 24px;
        position: relative;

        .grid-card_body_left {
            font-size: 30px;
            font-weight: 500;
            color: #42B884;
        }

        .grid-card_body_right {
            text-align: right;
            position: absolute;
            right: 0;

            .grid-card_body_right_icon {
                margin-top: -10px;
                border-radius: 50%;
                width: 56px;
                height: 56px;
                background: #BFD3FA;

                > i {
                    font-size: 30px;
                    display: inline-block;
                    position: relative;
                    left: -13px;
                    top: 12px;
                    color: #1661DD;
                }
            }
        }
    }

    .grid-card_footer {
        padding: 10px 24px;
        color: #9F9F9F;
        font-size: 12px;
    }
}
</style>